# # @Time    :2025/3/27 19:11
# """
# 支持切片反转
# 1，list列表    [,,]
# 2,tuple      (,,),是不可变序列，会更新地址，所有要有一个对象接收
# 3,str
# 4,range
# 5,NumPy数组
# """
#
# # ---------------list两种反转 切片和 reverse-------------------
# list1 = [1, -2, 1, 3, 4, 5, 0, "12"]
# list1.reverse()
# print(list1)
#
# print(list1[::-1])
#
# # ---------------tuple 切片------------------
# tuple1 = (2, -2, 1, 3, 4, 5, 0, "12")
# print(tuple1[::-1])
#
# """
# def reverse_i(num_input):
#     i = 1
#     if num_input < 0:
#         num_input = - num_input  # 如果小于0就是负数，负负就得正数
#     #        i = -1
#     new = str(num_input)
#     new = new[::-1]
#     num_input = int(new)
#     return num_input * (-i)
# """
#
# # ---------------str 切片------------------
# # str1 = "3, -2, 1, 3, 4, 5, 0, '12'"  #不会反转
# num = int(input("输入："))
# i = 1
# if num < 0:
#     i = -1
#     num = -num  # 内层循环，如果是 负数就 将i 置为1， --得正往下处理
# new = str(num)  # 字符串、元组、列表list是有序序列，支持索引切片操作
# news = new[::-1]
# num = int(news)
# print(num * i)
#
# # ----------------str纯字母反转-----------
# str2 = "hello kl"
# print(str2[::-1])  # 可以 # lk olleh
#
# # ----------------range-----------
# r = range(1, 4)
# print(r[::-1])  # range(3, 0, -1)
#
# # ----------------numpy-----------
# import numpy as np
#
# arr = np.array([1, 2, 3, 4, 5])
# print(arr[1:4])  # 输出：[2 3 4]
# print(arr[::-1])  # 输出：[5 4 3 2 1]（反转）

tup1 = (1, 2, 3, 4, 5)
print(str(tup1))
print(tup1[::-1])

new = str(12)
print(new)

dict1 = {"name": "zhang", "age": 12, "gender": "gi"}
val = list(dict1.values())
print(val)
print(val[::-1])

my_dict = {"a": 1, "b": 2, "c": 3}
reversed_values = list(my_dict.values())[::-1]  # 反转字典的值
print(reversed_values)  # 输出：[3, 2, 1]

